<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../../value/value_en.php";
} else if($lang == "VN") {
	include "../../value/value_vn.php";
}
else {
	include "../../value/value_kr.php";
}
include '../../operations/connection.php';	



$mangquy=array(1,1,1,2,2,2,3,3,3,4,4,4);
$mq=array(1=>array(1,3),2=>array(4,6),3=>array(7,9),4=>array(10,12));

if(!isset($_REQUEST["abc"])){
	$_REQUEST["abc"]="all";
}
$_SESSION['loaitimkiem']=$_REQUEST["abc"];

if($_SESSION['loaitimkiem']=="ngay"){
	$_REQUEST['datefrom']=date("Y-m-d");
	$_REQUEST['dateto']=date("Y-m-d");
	$_REQUEST['vttime']=$_REQUEST['datefrom']." ~ ".$_REQUEST['dateto'];
}else if($_SESSION['loaitimkiem']=="thang"){
	$_REQUEST['syear']=$vyear=date("Y");
	$_REQUEST['smonths']=date("m");
	
	$ntt=date("t",mktime(0,0,0,$_REQUEST['smonths'],1,$_REQUEST['syear']));
	
	$_REQUEST['vttime']=$_REQUEST['syear']."-".$_REQUEST['smonths']."-01"." ~ ".$_REQUEST['syear']."-".$_REQUEST['smonths']."-".$ntt;
	
}else if($_SESSION['loaitimkiem']=="qui"){
	$_REQUEST['nam']=$vyear=date("Y");
	$_REQUEST['qmonths']=$mangquy[date("m")-1];
	$ntt=date("t",mktime(0,0,0,$mq[$_REQUEST['qmonths']][1],1,$_REQUEST['nam']));
	if($mq[$_REQUEST['qmonths']][0]<10){
		$_REQUEST['vttime']=$_REQUEST['nam']."-0".$mq[$_REQUEST['qmonths']][0]."-01"." ~ ".$_REQUEST['nam']."-0".$mq[$_REQUEST['qmonths']][1]."-".$ntt;
	}else{
		$_REQUEST['vttime']=$_REQUEST['nam']."-".$mq[$_REQUEST['qmonths']][0]."-01"." ~ ".$_REQUEST['nam']."-".$mq[$_REQUEST['qmonths']][1]."-".$ntt;
	}
	
}else if($_SESSION['loaitimkiem']=="all"){
	$_REQUEST['nam']=$vyear=date("Y");
	if(isset($_REQUEST['nam']))
		$_REQUEST['vttime']=$_REQUEST['nam']."-01-01"." ~ ".$_REQUEST['nam']."-12-31";
	else $_REQUEST['vttime']='~';
	
}
$_REQUEST['cbcus']="";
$thoigianphgd=$l_created_date;





?>


<table cellpadding="0" cellspacing="0" width="100%" border="1" class="atable" >
		        	<tr>
		            	<td class="ffirst" style="text-align:left;height:24px;width: 180px;"><span>*</span><?=$l_phanbiet?></td>
		                <td style="text-align:left">
			                <label style="padding-left: 10px"><input type="radio" onclick="changeDistinction('ngay')" id="abc_ngay" name="abc" value="ngay" <?php if ($_REQUEST["abc"]=="ngay") echo "checked";?> /><?=$l_theongay?></label>
			                <label style="padding-left: 10px"><input type="radio" onclick="changeDistinction('thang')" id="abc_thang" name="abc" value="thang" <?php if ($_REQUEST["abc"]=="thang") echo "checked";?> /><?=$l_theothang?></label>
			                <label style="padding-left: 10px"><input type="radio" onclick="changeDistinction('qui')" id="abc_qui" name="abc" value="qui" <?php if ($_REQUEST["abc"]=="qui") echo "checked";?> /><?=$l_theoqui?></label>
			                <label style="padding-left: 10px"><input type="radio" onclick="changeDistinction('all')" id="abc_all" name="abc" value="all" <?php if ($_REQUEST["abc"]=="all") echo "checked";?> /><?=$l_all?></label>
		                </td>
		                <?php 
		                
	                		if($_REQUEST["abc"]=="ngay"){
	                			?>
	                			<!-- <td class="ffirst" style="text-align:left"><span>*</span><?php echo $l_days;?></td>
	                			<td  style="text-align:left;">
		                			<input type="text" id="datefrom" name="datefrom" value="<?=$_REQUEST['datefrom']?>" class="ftext" readonly="readonly"/> ~ 
		                			<input onchange="changedatefrom();" type="text" id="dateto" name="dateto" value="<?=$_REQUEST['dateto']?>" class="ftext" readonly="readonly"/>
	                			</td>  -->
	                			<td colspan="2" style="text-align: left;">
		                			<?php if($typedate=='ngayph'){?>
		                				<label style="padding-left: 10px"><input type="checkbox" id="notthoigiangiaodich"/><?=$thoigiangiaodich2?></label>
		                				<?php }?>
	                			</td>
	                			<?php 
	                		}else if($_REQUEST["abc"]=="thang"){
	                			?>
	                			<td class="ffirst" style="text-align:left"><span>*</span><?php echo $l_year."-".$l_month;?></td>
	                			<td  style="text-align:left;">
	                				<div style="padding-left:9px;">
		                			<select onchange="changeyear('thang');" style="width:80px;height:22px;font-size:12px;" id="syear" name="syear">
										<?php for($i=2012;$i<=$vyear;$i++){?>
											<option value="<?=$i?>"  
												<?php 
													if($i==$_REQUEST['syear']){
														?>
														selected="selected"
														<?php 
													}
												?>
											>
												<?php echo $i?>
											</option>
										<?php }?>
									</select>  
		                			<select onchange="changeyear('thang');" style="width:50px;height:22px;font-size:12px;" id="smonths" name="smonths">
										<?php for($i=1;$i<=12;$i++){?>
											<option value="<?=$i?>"  
												<?php 
													if($i==$_REQUEST['smonths']){
														?>
														selected="selected"
														<?php 
													}
												?>
											>
												<?php echo $i?>
											</option>
										<?php }?>
									</select>  
									<?php if($typedate=='ngayph'){?>
		                				<label style="padding-left: 10px"><input type="checkbox" id="notthoigiangiaodich"/><?=$thoigiangiaodich2?></label>
		                				<?php }?>
									</div>
									
									
	                			</td>
	                			<?php 
	                		}else if($_REQUEST["abc"]=="qui"){
	                			?>
	                			<td class="ffirst" style="text-align:left"><span>*</span><?php echo $l_year."-".$l_quy;?></td>
	                			<td  style="text-align:left;">
	                				<div style="padding-left:9px;">
		                			<select onchange="changequi('tinhqui');" style="width:80px;height:22px;font-size:12px;" id="nam" name="nam">
										<?php for($i=2012;$i<=$vyear;$i++){?>
											<option value="<?=$i?>"  
												<?php 
													if($i==$_REQUEST['nam']){
														?>
														selected="selected"
														<?php 
													}
												?>
											>
												<?php echo $i?>
											</option>
										<?php }?>
									</select>  
		                			<select onchange="changequi('tinhqui');" style="width:50px;height:22px;font-size:12px;" id="qmonths" name="qmonths">
										<?php for($i=1;$i<=4;$i++){?>
											<option value="<?=$i?>"  
												<?php 
													if($i==$_REQUEST['qmonths']){
														?>
														selected="selected"
														<?php 
													}
												?>
											>
												<?php echo $i?>
											</option>
										<?php }?>
									</select> 
									<?php if($typedate=='ngayph'){?>
		                				<label style="padding-left: 10px"><input type="checkbox" id="notthoigiangiaodich"/><?=$thoigiangiaodich2?></label>
		                				<?php }?> 
									</div>
									
	                			</td>
	                			<?php 
	                		}else if($_REQUEST["abc"]=="all"){
	                			?>
	                			<td class="ffirst" style="text-align:left"><span>*</span><?php echo $l_year;?></td>
	                			<td  style="text-align:left;">
	                				<div style="padding-left:9px;">
		                			<select onchange="changequi('tinhnam');" style="width:80px;height:22px;font-size:12px;" id="nam" name="nam">
										<?php for($i=2012;$i<=$vyear;$i++){?>
											<option value="<?=$i?>"  
												<?php 
													if($i==$_REQUEST['nam']){
														?>
														selected="selected"
														<?php 
													}
												?>
											>
												<?php echo $i?>
											</option>
										<?php }?>
									</select>  
										<label style="padding-left: 10px"><input type="checkbox" name="checknam" id="checknam" value="<?=$_REQUEST['checknam']?>" onclick="donam('<?=$typedate?>')" />&nbsp;<?=$l_all?></label>
									</div>
									
	                			</td>
	                			<?php 
	                		}
		                
		                ?>
		                
		            </tr>
		            <tr>
		            <?php 
		          
		            	if($_REQUEST["abc"]=="ngay"){
                		?>
                			<td class="ffirst" style="text-align:left"><span>*</span><?php echo $thoigianphgd;?></td>
                			<td  style="text-align:left;">
	                			<input type="text" id="datefrom" name="datefrom" value="<?=$_REQUEST['datefrom']?>" class="ftext" readonly="readonly" style="font-size:12px;font-weight:bold;text-align:center;"/> ~ 
	                			<input type="text" id="dateto" name="dateto" value="<?=$_REQUEST['dateto']?>" class="ftext" readonly="readonly" style="font-size:12px;font-weight:bold;text-align:center;"/>
                			</td>
                		<?php 
                		}else{
		            	?>
		            	<td class="ffirst" style="text-align:left"><span></span><?=$thoigianphgd?></td>
		                <td style="text-align:left">
							<div id="showtime" style="padding-left:9px";>
								<input type="text" id="vttime" name="vttime" value="<?=$_REQUEST['vttime']?>" style="border:none;background:none;width:200px;font-size:12px;font-weight:bold;" readonly="readonly"/>
							</div>
						</td>
		            	<?php 
	                	}
		            
		            ?>
		                <td class="ffirst" style="text-align:left"><span></span><?=$l_company_name?></td>
		                <td style="text-align:left">
		                	<div style="position:relative;padding-left:9px;">
								<div style="float:left;">
									<input  type="text" size="30" value="<?=$_REQUEST['cbcus']?>" name="cbcus" id="inputString"  style="height: 22px; width: 300px; border: 1px solid #c4c0c9;font-size: 12px;" autocomplete="off"; />
									<div class="suggestionsBox" id="suggestions" style="display:none;">
										<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
										<div class="suggestionList" id="autoSuggestionsList">
											&nbsp;
										</div>
									</div> 						
								</div>
								<div style=" float:left; position:relative; margin-top: 4px; margin-left: -24px; z-index:999">
									<img alt="" src="images/arrow-down.png" id="menu_expand" >
								    <div id="content_menu_expand" class="passul" style="display:none;">
								        <ul>
								        <?php 
								    		$sql="select ac_customer.CustomerName from ac_customer where ac_customer.Activest=1";
											$result = mysql_query($sql);
											if($result)
											{
												$i=0;
												while($row=mysql_fetch_array($result))
												{
													?>
													<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer('<?=$row['CustomerName']?>')" 
														<?php 
															if($i%2!=0){
																?>
																class="bgkhac"
																<?php 
															}
														?>
													> <?php echo $row['CustomerName'];?></li>
													<?php 
													$i++;
												}
											}
								    	?>
								        </ul>
								    </div>
								</div>
							</div>
							<div style="padding:5px;">
								<label style="padding-left: 10px"><input type="checkbox" name="checkkhung" id="checkkhung" value="<?=$_REQUEST['checkkhung']?>" onclick="dokhung()" />&nbsp;<?=$l_all?></label>
							</div>
		                </td>
		            </tr>
		        </table>
<?php mysql_close($connection);?>